package com.zhao.integration;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.ServiceActivator;

@MessageEndpoint
public class DefaultMessageEndpoint {

	protected static final Logger logger = LoggerFactory.getLogger(DefaultMessageEndpoint.class);

	public void handleMessage(String message) {
		logger.debug("接收到消息: {} @ {}", message, new Date());
	}

	//	, poller = @Poller("defaultPoller")
	@ServiceActivator(inputChannel = "inputChannel", outputChannel = "outputChannel")
	public void handle(String message) {
		logger.debug("接收到消息: {} @ {}", message, new Date());
	}

	@ServiceActivator(inputChannel = "eventPublishChannel")
	public void handle(Object event) throws Exception {
		logger.debug("订阅事件处理: {} @ {}", event, new Date());
	}

	@ServiceActivator(inputChannel = "asyncEventPublishChannel")
	public void asyncHandle(Object event) throws Exception {
		logger.debug("订阅事件异步处理: {} @ {}", event, new Date());
	}
}
